﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace BACKOFFICE
{
    public partial class MainProgram : DevExpress.XtraEditors.XtraForm
    {
        Thread DataUpdateThread;
        public static MainProgram _main;
        public MainProgram()
        {
            InitializeComponent();
            _main = this;
        }

        private void MainProgram_Load(object sender, EventArgs e)
        {
            panelControl1.Controls.Add(new SeatingChart());

            TimeSpan span = new TimeSpan(0, 0, 2, 30, 0);
            timer1.Interval = Convert.ToInt32(span.TotalMilliseconds);

            DataUpdateThread = new Thread(new ThreadStart(DataUpdateThreadStart));
            DataUpdateThread.Name = "DATA UPDATE THREAD";
            //DataUpdateThread.Start();
        }

        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(new EmployeeInfo());
        }

        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(new MenuItms());
        }

        public void DataUpdateThreadStart()
        {
            NetworkConnectionClass DataUpdater = new NetworkConnectionClass();
            DataUpdater.StartDataUpdater();
        }

        private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(new PosStations());
        }

        private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            panelControl1.Controls.Clear();
            panelControl1.Controls.Add(new DataUpdateTest());
        }
    }
}
